
import { Navigate, useRoutes } from "react-router-dom";
import Login from '@/pages/login/login'
import Home from '@/pages/home/home'
import Second from '@/pages/second/second'
import Second1 from '@/pages/second-1/second-1'
import Layout from "@/layout/index"

export const partRouter = [
    {

        title: '菜单1',
        element: <Layout />,
        icon: "MailOutlined",
        meta: {
        },
        children: [
            {
                path: '/menu/menu1-1',
                title: '菜单1-1',
                element: <Home />,
                meta: {

                }
            },
            {
                path: '/menu/menu1-2',
                title: '菜单1-2',
                element: <Second />,
                meta: {

                },
            },
            {
                path: '/menu/menu1-2/menu1-2-1',
                title: '菜单1-2-1',
                element: <Second1 />,
                meta: {

                },
            },

        ],
    },
    {

        element: <Layout />,
        children: [{
            path: '/menu2/index',
            title: '菜单2',
            element: <Second1 />,
            meta: {
            },
            icon: 'SettingOutlined',
        }]
    },
    {

        title: '菜单3',
        element: <Layout />,
        icon: "MailOutlined",
        meta: {

        },
        children: [
            {
                path: '/menu3/menu3-1',
                title: '菜单3-1',
                element: <Second1 />,
                meta: {
                }
            }
        ]
    }
]
export const openRouter = [
    {
        path: "/",
        element: <Navigate to="/login" />
    },
    {
        path: "/login",
        element: <Login />,
        meta: {
            // title: "登录页",
            key: "login"
        }
    },
]
export const allRouter = [
    ...openRouter,
    ...partRouter
]

const Router = () => {
    const routes = useRoutes(allRouter);
    return routes;
};

export default Router;     //导出所有路由





